setMovementConstraint

Set a rule that limits how far blocks can be positioned outside their parent page during user interactions (drag, resize, touch gestures, crop, nudge). Programmatic API calls are not affected.

MovementConstraintRule.overshoot is a non-negative fraction of the moved block's own size: 0f pins blocks fully inside the page, 0.3f allows 30% to extend past the page bounds. The rule's MovementConstraintRule.scope determines which blocks it applies to.

A rule on a page slice is the default for the blocks whose center the page slice holds, and its edges to the other page slices act as page edges for them. A block wider than the page slice is held in the page on that axis. During a drag or a touch pan, the page slice where it started applies, until it takes the block fully onto another page slice.

Use removeMovementConstraint to clear a rule.

When multiple rules match a block, the most specific one wins: block page slice parent page blockType scene-wide.

Parameters

rule

the rule to apply.


Set multiple movement constraint rules at once. See setMovementConstraint for details on a single rule.

Parameters

rules

the rules to apply.